#pragma once

#include "trie.h"

#include <map>
#include <string>
#include <utility>

namespace NSpellCheck {

class BigramCollection {
public:
    BigramCollection(const Trie<int>& dictionary);
    virtual ~BigramCollection();
    void addBigram(const std::string& firstWord, const std::string& secondWord, int frequency = 1);
    void addBigram(const int* it1, const int* it2, int frequency = 1);
    int getFrequency(const std::string& firstWord, const std::string& secondWord) const;
    int getFrequency(const int* it1, const int* it2) const;
public:
    static const int* SENTENCE_START;
    static const int* SENTENCE_END;
private:
    const Trie<int>& dictionary;
    std::map<std::pair<const int*, const int*>, int> bigrams;
};

} //ns
